import json
import urllib.request
import jsonpath
url = 'https://dianying.taobao.com/cityAction.json?activityId&_ksTS=1713692679418_240&jsoncallback=jsonp241&action=cityAction&n_s=new&event_submit_doGetAllRegion=true'

headers = {
    # ':authority':'dianying.taobao.com',
    # ':method':'GET',
    # ':path':'/cityAction.json?activityId&_ksTS=1713692679418_240&jsoncallback=jsonp241&action=cityAction&n_s=new&event_submit_doGetAllRegion=true',
    # ':scheme':'https',
    'Accept':'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01',
    # 'Accept-Encoding':'gzip, deflate, br, zstd',
    'Accept-Language':'zh-CN,zh;q=0.9,en-GB;q=0.8,en;q=0.7',
    'Bx-V':'2.5.11',
    'Cookie':'thw=cn; t=e6ee033d7ad454417d619c30c83aa43f; hng=CN%7Czh-CN%7CCNY%7C156; _uetvid=b1426160cb4a11ee820d5b1da03fa388; tfstk=eT72hGjtjrU47ulC03Yw49bM3ILvJeeIgN96s1fMGKvmlEtg_9pS5SLbXFWwUOpXcEbN2V5d6ZNv5SLAMFLgdJaQdsCvWRAMCpUIMYCD1JwQRzZmZFy4di6Kysshqal_mP-LK6plzvWeh3rPtLui8Xd2mQ4pUV0GzI5yKsVKSVbygnSylAdlLNbO0AmwmQdyd7PysskEGBlbrzitX3YpapNXGcn9mQdyd7PrXcKkeQJQGI1..; cookie2=1377fdbb0d0eaf27908be51337b89f8b; v=0; _tb_token_=5b88e83a58734; cna=UU7sHRyl5zUCARsvAv1fOKUz; cna=UU7sHRyl5zUCARsvAv1fOKUz; xlly_s=1; isg=BHV1JGNWfxCDUZhEsEcViJZ4hPEv8ikEC27ln_eYa-w7zpXAv0BP1M4IGJJ4jkG8',
    'Referer':'https://dianying.taobao.com/',
    'Sec-Ch-Ua':'"Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"',
    'Sec-Ch-Ua-Mobile':'?0',
    'Sec-Ch-Ua-Platform':'"Windows"',
    'Sec-Fetch-Dest':'empty',
    'Sec-Fetch-Mode':'cors',
    'Sec-Fetch-Site':'same-origin',
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
    'X-Requested-With':'XMLHttpRequest',

}

request = urllib.request.Request(url=url,headers=headers)
response = urllib.request.urlopen(request)
content = response.read().decode('utf-8')
content = content.split('(')[1].split(')')[0]
obj = json.loads(content)
city_list = jsonpath.jsonpath(obj,'$..regionName')
print(city_list)